<!DOCTYPE HTML>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, initial-scale=1.0, width=device-width" />
    <meta name="format-detection" content="telephone=no, email=no, date=no, address=no">
    <title>变更状态</title>
    <link rel="stylesheet" type="text/css" href="../css/mui.min.css" />
    <link rel="stylesheet" type="text/css" href="../css/common.css"/>
	<style type="text/css">
    	.detail{
    		padding-right: 20px!important;
    	}
    	h5{color: #0062CC;}
    	.mui-navigate-right .mui-col-xs-8{
		    width: 62.666667%!important;
    	}
    	.mui-text-right input,.mui-text-right textarea{
    		border: 0;
    		font-size: 14px;
		    font-weight: 400;
		    color: #8f8f94;
    		margin-bottom: 0;
    		text-align: right;
    	}
    </style>
</head>

<body>
    <div class="mui-content">
		<ul class="mui-table-view mui-table-view-chevron">
			<li class="mui-table-view-cell detail">
				<div class="mui-table">
	                <div class="mui-table-cell mui-col-xs-4">
	                    <h5 class="mui-ellipsis">编号：</h5>
	                </div>
	                <div class="mui-table-cell mui-col-xs-8 mui-text-right">
	                    <span class="mui-h5" id="wonum"></span>
	                </div>
	            </div>
			</li>
			<li class="mui-table-view-cell detail">
				<div class="mui-table">
	                <div class="mui-table-cell mui-col-xs-4">
	                    <h5 class="mui-ellipsis">类型：</h5>
	                </div>
	                <div class="mui-table-cell mui-col-xs-8 mui-text-right">
	                    <span class="mui-h5" id="worktype"></span>
	                </div>
	            </div>
			</li>
			<li class="mui-table-view-cell detail">
				<div class="mui-table">
	                <div class="mui-table-cell mui-col-xs-4">
	                    <h5 class="mui-ellipsis">状态：</h5>
	                </div>
	                <div class="mui-table-cell mui-col-xs-8 mui-text-right">
	                    <span class="mui-h5" id="status"></span>
	                </div>
	            </div>
			</li>
			<li class="mui-table-view-cell detail">
				<div class="mui-table">
	                <div class="mui-table-cell mui-col-xs-4">
	                    <h5 class="mui-ellipsis">描述：</h5>
	                </div>
	                <div class="mui-table-cell mui-col-xs-8 mui-text-right">
	                    <span class="mui-h5" id="desc"></span>
	                </div>
	            </div>
			</li>
			<li class="mui-table-view-cell detail">
				<div class="mui-table">
	                <div class="mui-table-cell mui-col-xs-4">
	                    <h5 class="mui-ellipsis">当前主管人：</h5>
	                </div>
	                <div class="mui-table-cell mui-col-xs-8 mui-text-right">
	                    <span class="mui-h5" id="managerName"></span>
	                </div>
	            </div>
			</li>
		</ul>
		<ul class="mui-table-view mui-table-view-chevron type_list_spair">
			<li class="mui-table-view-cell detail" onclick="openSaveWin('work_order_sel_manager','选择人员',{manager:true})">
				<div class="mui-table mui-navigate-right">
	                <div class="mui-table-cell mui-col-xs-4">
	                    <h5 class="mui-ellipsis">下一步主管人：</h5>
	                </div>
	                <div class="mui-table-cell mui-col-xs-8 mui-text-right">
	                    <span class="mui-h5" id="NextmanagerName">请选择下一步主管人</span>
	                </div>
	            </div>
			</li>
			<li class="mui-table-view-cell detail"  tapmode onclick="openSaveWin('work_order_sel_status','选择状态')">
				<div class="mui-table mui-navigate-right">
	                <div class="mui-table-cell mui-col-xs-4">
	                    <h5 class="mui-ellipsis">状态：</h5>
	                </div>
	                <div class="mui-table-cell mui-col-xs-8 mui-text-right">
	                    <span class="mui-h5" id="statusName">请选择状态</span>
	                </div>
	            </div>
			</li>
			<li class="mui-table-view-cell detail">
				<div class="mui-table">
	                <div class="mui-table-cell mui-col-xs-4">
	                    <h5 class="mui-ellipsis">描述：</h5>
	                </div>
	                <div class="mui-table-cell mui-col-xs-8 mui-text-right">
	                    <textarea id="desc" name="" rows="" cols="" placeholder="请输入描述"></textarea>
	                </div>
	            </div>
			</li>
		</ul>
    </div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script src="../script/mui.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../script/common.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
	var supervisor,statusId;
	apiready = function() {
		$api.text($api.byId('wonum'),api.pageParam.wonum);
		$api.text($api.byId('worktype'),api.pageParam.worktype);
		$api.text($api.byId('status'),api.pageParam.status);
		$api.text($api.byId('statusName'),api.pageParam.status);
		$api.text($api.byId('desc'),api.pageParam.desc);
		supervisor = $api.getStorage('partsInfo').loginId;
		statusId = api.pageParam.status;
        $api.html($api.byId('NextmanagerName'), $api.getStorage('partsInfo').userName);
		if (api.pageParam.managerNum&&api.pageParam.managerNum !== '')
		$api.text($api.byId('managerName'), api.pageParam.managerNum + '/' + api.pageParam.managerName);
		api.addEventListener({
            name: 'ManagerCh'
        }, function(ret, err) {
            supervisor = ret.value.userID;
            $api.html($api.byId('NextmanagerName'), ret.value.userName)
        })
		// 选择状态
	    api.addEventListener({
	        name: 'status'
	    }, function(ret, err) {
	      statusId = ret.value.statusName
	      $api.html($api.byId('statusName'),ret.value.statusName)
	    });
		api.addEventListener({
            name: 'navitembtn'
        }, function(ret, err) {
            if (ret.index == 0) {
                if (supervisor == '' || supervisor == null) {
                    Toast('请选择主管人！');
                    return
                }
                if (statusId == '' || statusId == null) {
                    Toast('请选择更改状态！');
                    return
                }
                ajaxrd("updateWorkOrderStatus", {
                	wonum: api.pageParam.wonum,
                	workorderid: api.pageParam.workorderid,
                	status: statusId,
                	supervisor:supervisor,
                	description:$api.val($api.byId('desc'))
                }, function(ret, err) {
                    api.sendEvent({
                        name: 'onload',
                        extra: {
                            isrefersh: 'yes'
                        }
                    });
                    Toast('变更成功！');
                    setTimeout(function() {
                        api.closeWin();
                    }, 500)
                })
            } else { //扫码

            }
        });
	}
</script>

</html>
